package com.java.netty.nio.netty.buf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * @Author: Dgg
 * @Date: 2021/12/26 23:10
 */
public class NettyByteBuf01 {
	public static void main(String[] args) {
		//netty 中buf 不需要filp进行反转，因为底层维护了readerIndex 和 writerIndex
		ByteBuf buffer = Unpooled.buffer(10);
		for (int i = 0; i < 10; i++) {
			buffer.writeByte(i);
		}
		System.out.println("capacity:" + buffer.capacity());
		for (int i = 0; i < buffer.capacity(); i++) {
			System.out.println(buffer.getByte(i));
		}
	}
}
